Optimal. Leaf size=212 \[ \frac {C \tanh ^{-1}(\sin (c+d x))}{b^3 d}-\frac {a \left (3 A b^4+\left (2 a^4-5 a^2 b^2+6 b^4\right ) C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} b^3 (a+b)^{5/2} d}+\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (2 A b^4-3 a^4 C+a^2 b^2 (A+6 C)\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.44, antiderivative size = 212, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.212, Rules used = {4176, 4165,
4083, 3855, 3916, 2738, 214} \begin {gather*} \frac {a \left (a^2 C+A b^2\right ) \tan (c+d x)}{2 b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))^2}+\frac {\left (-3 a^4 C+a^2 b^2 (A+6 C)+2 A b^4\right ) \tan (c+d x)}{2 b^2 d \left (a^2-b^2\right )^2 (a+b \sec (c+d x))}-\frac {a \left (C \left (2 a^4-5 a^2 b^2+6 b^4\right )+3 A b^4\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^3 d (a-b)^{5/2} (a+b)^{5/2}}+\frac {C \tanh ^{-1}(\sin (c+d x))}{b^3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3855
Rule 3916
Rule 4083
Rule 4165
Rule 4176
Rubi steps
\begin {align*} \int \frac {\sec ^2(c+d x) \left (A+C \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^3} \, dx &=\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\int \frac {\sec (c+d x) \left (-2 b \left (A b^2+a^2 C\right )+a \left (A b^2-\left (a^2-2 b^2\right ) C\right ) \sec (c+d x)+2 b \left (a^2-b^2\right ) C \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^2} \, dx}{2 b^2 \left (a^2-b^2\right )}\\ &=\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (2 A b^4-3 a^4 C+a^2 b^2 (A+6 C)\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\int \frac {\sec (c+d x) \left (-a b^2 \left (a^2 C-b^2 (3 A+4 C)\right )-2 b \left (a^2-b^2\right )^2 C \sec (c+d x)\right )}{a+b \sec (c+d x)} \, dx}{2 b^3 \left (a^2-b^2\right )^2}\\ &=\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (2 A b^4-3 a^4 C+a^2 b^2 (A+6 C)\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}+\frac {C \int \sec (c+d x) \, dx}{b^3}-\frac {\left (a \left (3 A b^4+\left (2 a^4-5 a^2 b^2+6 b^4\right ) C\right )\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{2 b^3 \left (a^2-b^2\right )^2}\\ &=\frac {C \tanh ^{-1}(\sin (c+d x))}{b^3 d}+\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (2 A b^4-3 a^4 C+a^2 b^2 (A+6 C)\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\left (a \left (3 A b^4+\left (2 a^4-5 a^2 b^2+6 b^4\right ) C\right )\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{2 b^4 \left (a^2-b^2\right )^2}\\ &=\frac {C \tanh ^{-1}(\sin (c+d x))}{b^3 d}+\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (2 A b^4-3 a^4 C+a^2 b^2 (A+6 C)\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\left (a \left (3 A b^4+\left (2 a^4-5 a^2 b^2+6 b^4\right ) C\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^4 \left (a^2-b^2\right )^2 d}\\ &=\frac {C \tanh ^{-1}(\sin (c+d x))}{b^3 d}-\frac {a \left (3 A b^4+2 a^4 C-5 a^2 b^2 C+6 b^4 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} b^3 (a+b)^{5/2} d}+\frac {a \left (A b^2+a^2 C\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (2 A b^4-3 a^4 C+a^2 b^2 (A+6 C)\right ) \tan (c+d x)}{2 b^2 \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 5.56, size = 445, normalized size = 2.10 \begin {gather*} \frac {(b+a \cos (c+d x)) \sec (c+d x) \left (A+C \sec ^2(c+d x)\right ) \left (-4 C (b+a \cos (c+d x))^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+4 C (b+a \cos (c+d x))^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {4 a \left (3 A b^4+\left (2 a^4-5 a^2 b^2+6 b^4\right ) C\right ) \text {ArcTan}\left (\frac {(i \cos (c)+\sin (c)) \left (a \sin (c)+(-b+a \cos (c)) \tan \left (\frac {d x}{2}\right )\right )}{\sqrt {a^2-b^2} \sqrt {(\cos (c)-i \sin (c))^2}}\right ) (b+a \cos (c+d x))^2 (i \cos (c)+\sin (c))}{\left (a^2-b^2\right )^{5/2} \sqrt {(\cos (c)-i \sin (c))^2}}+\frac {b \left (a \sec (c) \left (\left (4 A b^5-7 a^4 b C+a^2 b^3 (5 A+16 C)\right ) \sin (d x)+a \left (a b \left (-3 A b^2+\left (a^2-4 b^2\right ) C\right ) \sin (2 c+d x)+\left (A b^4-2 a^4 C+a^2 b^2 (2 A+5 C)\right ) \sin (c+2 d x)\right )\right )+\left (a^2+2 b^2\right ) \left (-A b^4+2 a^4 C-a^2 b^2 (2 A+5 C)\right ) \tan (c)\right )}{a \left (a^2-b^2\right )^2}\right )}{2 b^3 d (A+2 C+A \cos (2 (c+d x))) (a+b \sec (c+d x))^3} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.56, size = 317, normalized size = 1.50 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 629 vs.
\(2 (200) = 400\).
time = 17.29, size = 1317, normalized size = 6.21 \begin {gather*} \left [\frac {{\left (2 \, C a^{5} b^{2} - 5 \, C a^{3} b^{4} + 3 \, {\left (A + 2 \, C\right )} a b^{6} + {\left (2 \, C a^{7} - 5 \, C a^{5} b^{2} + 3 \, {\left (A + 2 \, C\right )} a^{3} b^{4}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (2 \, C a^{6} b - 5 \, C a^{4} b^{3} + 3 \, {\left (A + 2 \, C\right )} a^{2} b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + 2 \, {\left (C a^{6} b^{2} - 3 \, C a^{4} b^{4} + 3 \, C a^{2} b^{6} - C b^{8} + {\left (C a^{8} - 3 \, C a^{6} b^{2} + 3 \, C a^{4} b^{4} - C a^{2} b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (C a^{7} b - 3 \, C a^{5} b^{3} + 3 \, C a^{3} b^{5} - C a b^{7}\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (C a^{6} b^{2} - 3 \, C a^{4} b^{4} + 3 \, C a^{2} b^{6} - C b^{8} + {\left (C a^{8} - 3 \, C a^{6} b^{2} + 3 \, C a^{4} b^{4} - C a^{2} b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (C a^{7} b - 3 \, C a^{5} b^{3} + 3 \, C a^{3} b^{5} - C a b^{7}\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (3 \, C a^{6} b^{2} - {\left (A + 9 \, C\right )} a^{4} b^{4} - {\left (A - 6 \, C\right )} a^{2} b^{6} + 2 \, A b^{8} + {\left (2 \, C a^{7} b - {\left (2 \, A + 7 \, C\right )} a^{5} b^{3} + {\left (A + 5 \, C\right )} a^{3} b^{5} + A a b^{7}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, {\left ({\left (a^{8} b^{3} - 3 \, a^{6} b^{5} + 3 \, a^{4} b^{7} - a^{2} b^{9}\right )} d \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b^{4} - 3 \, a^{5} b^{6} + 3 \, a^{3} b^{8} - a b^{10}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b^{5} - 3 \, a^{4} b^{7} + 3 \, a^{2} b^{9} - b^{11}\right )} d\right )}}, -\frac {{\left (2 \, C a^{5} b^{2} - 5 \, C a^{3} b^{4} + 3 \, {\left (A + 2 \, C\right )} a b^{6} + {\left (2 \, C a^{7} - 5 \, C a^{5} b^{2} + 3 \, {\left (A + 2 \, C\right )} a^{3} b^{4}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (2 \, C a^{6} b - 5 \, C a^{4} b^{3} + 3 \, {\left (A + 2 \, C\right )} a^{2} b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (C a^{6} b^{2} - 3 \, C a^{4} b^{4} + 3 \, C a^{2} b^{6} - C b^{8} + {\left (C a^{8} - 3 \, C a^{6} b^{2} + 3 \, C a^{4} b^{4} - C a^{2} b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (C a^{7} b - 3 \, C a^{5} b^{3} + 3 \, C a^{3} b^{5} - C a b^{7}\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (C a^{6} b^{2} - 3 \, C a^{4} b^{4} + 3 \, C a^{2} b^{6} - C b^{8} + {\left (C a^{8} - 3 \, C a^{6} b^{2} + 3 \, C a^{4} b^{4} - C a^{2} b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (C a^{7} b - 3 \, C a^{5} b^{3} + 3 \, C a^{3} b^{5} - C a b^{7}\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + {\left (3 \, C a^{6} b^{2} - {\left (A + 9 \, C\right )} a^{4} b^{4} - {\left (A - 6 \, C\right )} a^{2} b^{6} + 2 \, A b^{8} + {\left (2 \, C a^{7} b - {\left (2 \, A + 7 \, C\right )} a^{5} b^{3} + {\left (A + 5 \, C\right )} a^{3} b^{5} + A a b^{7}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{8} b^{3} - 3 \, a^{6} b^{5} + 3 \, a^{4} b^{7} - a^{2} b^{9}\right )} d \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b^{4} - 3 \, a^{5} b^{6} + 3 \, a^{3} b^{8} - a b^{10}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b^{5} - 3 \, a^{4} b^{7} + 3 \, a^{2} b^{9} - b^{11}\right )} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \sec ^{2}{\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{3}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 509 vs.
\(2 (200) = 400\).
time = 0.53, size = 509, normalized size = 2.40 \begin {gather*} -\frac {\frac {{\left (2 \, C a^{5} - 5 \, C a^{3} b^{2} + 3 \, A a b^{4} + 6 \, C a b^{4}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{3}} + \frac {C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{3}} - \frac {2 \, C a^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, C a^{4} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, A a^{3} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 5 \, C a^{3} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + A a^{2} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, C a^{2} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, A b^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, C a^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, C a^{4} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, A a^{3} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 5 \, C a^{3} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a^{2} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C a^{2} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, A b^{5} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a - b\right )}^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 13.17, size = 2500, normalized size = 11.79 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________